package com.toutou.base.adapter.viewholder

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.recyclerview.widget.RecyclerView

abstract class BaseNormalViewHolder<T, CB : ViewDataBinding> private constructor(
    protected var context: Context?,
    view: View
) : RecyclerView.ViewHolder(view) {
    protected var mBinding: CB = DataBindingUtil.bind(itemView)!!


    constructor(context: Context?, @LayoutRes layoutResID: Int, parent: ViewGroup?) : this(
        context,
        LayoutInflater.from(context).inflate(layoutResID, parent, false)
    ) {
        init()
    }

    open fun init(){}

    abstract fun bindData(data: T)

}
